package com.runvp.common.enums;


/**
 * 订单状态 (goOn:进行中,close:强制关闭,timeoutClose:超时关闭,completed:已完成)
 * @author xukk_dp
 */

public enum OrderStatus implements BaseEnumInterface {

    GO_ON("goOn", "进行中"),
    CLOSE("close", "强制关闭"),
    TIMEOUT_CLOSE("timeoutClose", "超时关闭"),
    COMPLETED("completed", "完成");

    private final String code;
    private final String desc;
    private String defaulted;

    @Override
    public String getDefaulted() {
        return defaulted;
    }


    OrderStatus(String code, String desc, String defaulted) {
        this.code = code;
        this.desc = desc;
        this.defaulted = defaulted;
    }

    OrderStatus(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }


    @Override
    public String getCode() {
        return code;
    }
    @Override
    public String getDesc() {
        return desc;
    }


    /**
     * 获取枚举描述
     *
     * @param key
     * @return boolean true：包含，  false：不包含
     */
    public static String getDesc(String key) {
        if (null == key || "".equals(key)) {
            return "未知";
        }
        for (ProductType e : ProductType.values()) {
            if (key.equals(e.getCode())) {
                return e.getDesc();
            }
        }
        return "未知";
    }
}
